#include <iostream>
#include <string>
#include <memory>
using namespace std;
class Fruit {
 public:
 Fruit(){}
 virtual void show() = 0;
};
class Apple : public Fruit {
 public:
 Apple() {}
 virtual void show() {
 std::cout << "我是⼀个苹果" << std::endl;
 }
 private:
 std::string _color;
};
class Banana : public Fruit {
 public:
 Banana() {}
 virtual void show() {
 std::cout << "我是⼀个⾹蕉" << std::endl;
 }
};
class Animal {
 public:
 virtual void voice() = 0;
};
class Lamp: public Animal {
 public:
 void voice() { std::cout << "咩咩咩\n"; }
};
class Dog: public Animal {
 public:
 void voice() { std::cout << "汪汪汪\n"; }
};
class Factory {
 public:
 virtual std::shared_ptr<Fruit> getFruit(const std::string &name) = 0;
 virtual std::shared_ptr<Animal> getAnimal(const std::string &name) = 0;
};
class FruitFactory : public Factory {
 public:
 virtual std::shared_ptr<Animal> getAnimal(const std::string &name) {
 return std::shared_ptr<Animal>();
 }
 virtual std::shared_ptr<Fruit> getFruit(const std::string &name) {
 if (name == "苹果") {
 return std::make_shared<Apple>();
 }else if(name == "⾹蕉") {
 return std::make_shared<Banana>();
 }
 return std::shared_ptr<Fruit>();
 }
};
class AnimalFactory : public Factory {
 
 public:
 virtual std::shared_ptr<Fruit> getFruit(const std::string &name) {
 return std::shared_ptr<Fruit>();
}
 virtual std::shared_ptr<Animal> getAnimal(const std::string &name) {
 if (name == "⼩⽺") {
 return std::make_shared<Lamp>();
 }else if(name == "⼩狗") {
 return std::make_shared<Dog>();
 }
 return std::shared_ptr<Animal>();
 }
};
class FactoryProducer {
 public:
 static std::shared_ptr<Factory> getFactory(const std::string &name) {
 if (name == "动物") {
 return std::make_shared<AnimalFactory>();
 }else {
 return std::make_shared<FruitFactory>();
 }
 }
};
int main()
{
    return 0;
}